package main

import (
	"go-glue.googlecode.com/hg/rlglue"
)

type EmptyEnv struct {
	whichEpisode	int
	emptyObs	rlglue.Observation
	nonEmptyObs	rlglue.Observation
}

func (re *EmptyEnv) EnvInit() string {
	re.emptyObs = rlglue.NewObservation([]int32{}, []float64{}, []byte{})
	re.nonEmptyObs = rlglue.NewObservation([]int32{0, 1}, []float64{0.0 / 4.0, 1.0 / 4.0, 2.0 / 4.0, 3.0 / 4.0}, []byte{'a', 'b', 'c', 'd', 'e'})
	return ""
}
func (re *EmptyEnv) EnvStart() rlglue.Observation {
	re.whichEpisode += 1
	if re.whichEpisode%2 == 0 {
		return re.emptyObs
	}
	return re.nonEmptyObs
}
func (re *EmptyEnv) EnvStep(action rlglue.Action) (obs rlglue.Observation, r float64, t bool) {
	if re.whichEpisode%2 == 0 {
		obs = re.emptyObs
	} else {
		obs = re.nonEmptyObs
	}
	r = 0
	t = false
	return
}
func (re *EmptyEnv) EnvCleanup() {
}
func (re *EmptyEnv) EnvMessage(message string) (reply string) {
	return
}
func main() {
	if err := rlglue.LoadEnvironment(new(EmptyEnv)); err != nil {
		panic(err)
	}
}
